/**
 *
 * @param {*} name
 */
export const getQueryString = name => {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
};

export const openApp = () => {
    if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
        var loadDateTime = new Date();
        window.setTimeout(function () {
            var timeOutDateTime = new Date();
            if (timeOutDateTime - loadDateTime < 5000) {
                window.location = '要跳转的下载app页面URL';
            } else {
                window.close();
            }
        }, 25);
        window.location.href = ' apps custom url schemes ';
    } else if (navigator.userAgent.match(/android/i)) {
        var loadDateTime = new Date();
        window.location.href = 'apps custom url schemes ';
        window.setTimeout(function () {
            var timeOutDateTime = new Date();
            if (timeOutDateTime - loadDateTime < 5000) {
                window.location = '要跳转的下载app页面URL';
            } else {
                window.close();
            }
        }, 25);
    }
};
